/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ConfigButtonPanel.java
 *
 * Created on Aug 27, 2010, 12:01:19 AM
 */

package org.apache.directory.http.client.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import org.apache.directory.http.client.ui.callback.ConfigButtonSelectionHandler;

/**
 *
 * @author kayyagari
 */
public class ConfigButtonPanel extends javax.swing.JPanel implements ActionListener {

    private ConfigButtonSelectionHandler buttonHandler;

    /** Creates new form ConfigButtonPanel */
    public ConfigButtonPanel() {
        initComponents();
        btnInterceptors.addActionListener(this);
        btnPartitions.addActionListener(this);
        btnBrowse.addActionListener( this );
    }

    public void setButtonSelectionHandler(ConfigButtonSelectionHandler buttonHandler)
    {
        this.buttonHandler = buttonHandler;
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnInterceptors = new javax.swing.JButton();
        btnPartitions = new javax.swing.JButton();
        btnBrowse = new javax.swing.JButton();

        btnInterceptors.setText("Interceptors");

        btnPartitions.setText("Partitions");

        btnBrowse.setText("Browse");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(btnInterceptors, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
            .add(btnPartitions, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
            .add(btnBrowse, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(btnPartitions, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(btnInterceptors)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(btnBrowse)
                .addContainerGap(209, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBrowse;
    private javax.swing.JButton btnInterceptors;
    private javax.swing.JButton btnPartitions;
    // End of variables declaration//GEN-END:variables

    public void actionPerformed(ActionEvent e) {
        buttonHandler.handleConfigSelection( (JButton ) e.getSource());
    }

    public JButton getBtnInterceptors() {
        return btnInterceptors;
    }

    public JButton getBtnPartitions() {
        return btnPartitions;
    }

    public javax.swing.JButton getBtnBrowse()
    {
        return btnBrowse;
    }

}
